package cn.jobstart.enums;

/**
 * @author sunke
 * @Date 2023-11-08 20:27:27
 * @description 标签
 */

import cn.jobstart.common.NumberUtil;
import cn.jobstart.common.SkList;
import cn.jobstart.common.StringUtil;
import cn.jobstart.pubInter.EnumVO;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public enum SchoolFlagEnum {

    SCHOOL_985(1, "985"), SCHOOL_211(2, "211"), DOUBLE_FIRST_CLASS(4, "双一流");


    private Integer type;
    private String desc;

    SchoolFlagEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static String getDescByType(Integer type) {
        if (type == null) {
            type = 0;
        }
        List<String> labelList = SkList.getInstance();
        for (SchoolFlagEnum var : SchoolFlagEnum.values()) {
            if ((NumberUtil.parseInt(type) & var.getType().intValue()) == var.getType().intValue()) {
                labelList.add(var.getDesc());
            }

        }
        if(StringUtil.isNullOrEmpty(labelList)){
            return "";
        }
        return labelList.stream().collect(Collectors.joining("、"));
    }

    public static List<EnumVO> getDescs() {
        List list = new ArrayList();

        for (SchoolFlagEnum var : SchoolFlagEnum.values()) {
            EnumVO enumVO = new EnumVO();
            enumVO.setId(var.getType() + "");
            enumVO.setName(var.getDesc());
            list.add(enumVO);
        }


        return list;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
